package com.flea.web.controller;

import com.flea.model.Result;
import com.flea.web.websocket.MessageCountWebSocketHandler;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
public class MessageController {

    @Resource
    private MessageCountWebSocketHandler menuCountWebSocketHandler;

    /**
     * 模拟更新消息数量
     *
     * @param messageCount
     * @return
     */
    @PostMapping("/message")
    public Result simulate(Integer messageCount) {
        menuCountWebSocketHandler.sendMessage(messageCount);
        return Result.success("消息发送成功");
    }

}
